import 'package:flutter/material.dart';
import 'tab1_screen.dart';
import 'tab2_screen.dart';
import 'tab3_screen.dart';
import 'profile_screen.dart';

class HomeScreen extends StatefulWidget {
  const HomeScreen({super.key});

  @override
  State<HomeScreen> createState() => _HomeScreenState();


}

class _HomeScreenState extends State<HomeScreen> {
  int _currentIndex = 0;
  final List<Widget> _tabs = [

  const Tab1Screen(),
  const Tab2Screen(),
  const Tab3Screen(),
  ];


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Profile App'),
        actions: [
          IconButton(onPressed: () =>
              Navigator.push(context, MaterialPageRoute(
                builder: (context) => const ProfileScreen(),),),
              icon: const Icon(Icons.person))
        ],
      ),
      body: _tabs[_currentIndex],
      bottomNavigationBar: BottomNavigationBar(
        currentIndex: _currentIndex,
        items: const[
          BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'),
          BottomNavigationBarItem(
              icon: Icon(Icons.business), label: 'Business'),
          BottomNavigationBarItem(icon: Icon(Icons.school), label: 'School'),
        ],
        onTap: (index) {
          setState(() => _currentIndex = index);
        },
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () => _showSnackBar(context),
        child: const Icon(Icons.add),
      ),
    );
  }
}

void _showSnackBar(BuildContext context) {
  ScaffoldMessenger.of(context).showSnackBar(SnackBar(
    content: const Text('Action completed!'),
    action: SnackBarAction(
      label: 'OK',
      onPressed: () {},
    ),
  ));
}
